<?php

class AuthController extends Base_Controller
{

   public function init()
    {
    	parent::init();
    }

   
    public function indexAction()
    {
    	$this->_helper->layout->disableLayout();  

    }

    public function loginAction()
    {
    	$authService = Application_Model_UserService::getInstance();
    	$userInfo = $authService->getUserInfo($_POST['username'], $_POST['password']);
    	if ($userInfo != null) {
    		session_start();
    		$_SESSION['userinfo']=$userInfo;    		
       	}
       	
		$this->_redirect($_POST['fromUrl']);

    }

    public function logoutAction()
    {
    	unset($_SESSION['userinfo']);
       	
		$this->_redirect("/");

    }
    
}

